home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Enigma Amiga Life 109
/
EnigmaAmiga109CD.iso
/
dalla rivista
/
netconnect3
/
amirc_33
/
rexx
/
xref.amirx
< prev
Wrap
Text File
|
1999-12-26
|
3KB
|
140 lines
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
: XRef.amirx -- Scan all joined channels on all threads for identical hosts.
: Copyright ©1998-2000 by Jamie "Entity" van den Berge <entity@vapor.com>
:
: Usage: /rx XRef
:
: This script demonstrates using the FINDUSERHOST function and addressing
: multiple threads.
:
: Feel free to use this code in your own scripts
*/
SIGNAL ON SYNTAX
OPTIONS RESULTS
numhosts = 0
ports = SHOW( "P" )
/* remember the thread we were called from,
as we want to output the result there */
thisthread = ADDRESS()
DO WHILE ports~=""
PARSE VAR ports port" "ports
/* find next AmIRC thread */
IF LEFT( port, 6 )="AMIRC." THEN DO
thread = SUBSTR( port, 7 )
ADDRESS VALUE port
"CHANNELS"; channels = Result
/* now cycle through all channels joined in this thread
and collect the hosts in stem variables */
DO WHILE channels~=""
PARSE VAR channels channel" "channels /* get next channel */
DROP userhost.
/* this (ab)uses the AmIRC v3 FINDUSERHOST function to get
all nick!user@host patterns on the specified channel */
"FINDUSERHOST * STEMVAR=userhost CHANNEL="channel
DO i = 1 TO userhost.0
PARSE VAR userhost.i user"!"lamer"@"host
entry = thread channel user
IF SYMBOL( "db.host" ) = "VAR" THEN DO
/* host already seen before */
db.host = db.host entry; /* add location info to host entry */
cl.host = 1 /* mark host as clone */
END; ELSE DO
/* saw this host for the first time */
numhosts = numhosts+1
db.host = entry /* add first encounter info to this host */
db.numhosts = host /* add host to the list */
cl.host = 0 /* first encounter, so clear clone marker */
END
END
END
END
END
/* switch back to calling thread */
ADDRESS VALUE thisthread
hits = 0
/* scan the list of hosts encountered for entries with clone marker */
DO i = 1 TO numhosts
host = db.i
IF cl.host THEN DO
/* clone found! build list of locations where it was found ... */
hits = hits + 1
line = db.host
tc = 0
DROP thread. report. channels. nicks.
DO WHILE line~=""
PARSE VAR line t c n line
IF SYMBOL( "report.t" )="VAR" THEN DO
IF FIND( channels.t, c )=0 THEN channels.t = channels.t c
IF FIND( nicks.t, n )=0 THEN nicks.t = nicks.t n
END; ELSE DO
tc = tc+1;
thread.tc = t
report.t = 1;
channels.t = c
nicks.t = n
END
END
/* and echo it */
CALL Local( "Report on" Bold( host )":" )
DO y = 1 TO tc
t = thread.y
CALL Local( " Thread "Bold( t )": "nicks.t Bold( "->" ) channels.t )
END
END
END
IF hits = 0 THEN CALL Local( "No matches found." )
EXIT
Local : "ECHO P="||"1B"x||"b«XRef» TEXT="Arg(1); RETURN
ULine : RETURN "1F"x||Arg(1)"1F"x
Bold : RETURN "02"x||Arg(1)"02"x
Syntax: "ECHO Error "RC": "ErrorText(RC)" on line "SIGL